<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<link rel="stylesheet" href="/css/message.css" type="text/css" media="all" />

<script type="text/javascript">
	$(document).ready(function() {
		$("#registerForm").submit(function() {
			var studentId = $("#studentId").val();
			var studentName = $("#studentName").val();
			var studentEmail = $("#studentEmail").val();
			var password = $("#password").val();
			var confirmPassword = $("#confirmPassword").val();
			if (studentId == '' || studentName == '' || studentEmail == '' || password == '' || confirmPassword == '') {
				alert('Điền thiếu thông tin');
				return false;
			}
		});
	});
</script>

<div style="display: block; height: 40px"></div>
<div class="box">
	<h3 class="boxTitle">Đăng ký</h3>
	<form:form commandName="registerViewModel" method="POST" id="registerForm">
		<form:errors path="*" cssClass="errorblock" element="div" />
		<table align="center">
			<tr>
				<td>Mã số sinh viên (*)</td>
				<td><form:input path="studentId" id="studentId" cssClass="inputField" /></td>
			</tr>
			<tr>
				<td>Tên sinh viên (*)</td>
				<td><form:input path="studentName" id="studentName" cssClass="inputField" /></td>
			</tr>
			<tr>
				<td>Email (*)</td>
				<td><form:input path="studentEmail" id="studentEmail" cssClass="inputField" /></td>
			</tr>
			<tr>
				<td>Lớp (*)</td>
				<td>
					<form:select path="className" cssClass="inputField">
						<form:option value="NONE" label="--Chọn lớp--" />
						<form:options items="${classes}" />
					</form:select>
				</td>
				<td>Khóa (*)</td>
				<td>
					<form:select path="course">
						<form:option value="NONE" label="--Chọn khóa--" />
						<form:options items="${courses}"/>
					</form:select>
				</td>
			</tr>
			<tr>
				<td>Mật khẩu (*)</td>
				<td><form:password path="password" id="password" cssClass="inputField" /></td>
			</tr>
			<tr>
				<td>Xác nhận mật khẩu (*)</td>
				<td><form:password path="confirmPassword" id="confirmPassword" cssClass="inputField" /></td>
			</tr>
			<tr>
				<td colspan="4" align="center"><input type="submit" value="Đăng ký" /></td>
			</tr>
		</table>
	</form:form>
</div>